package com.xmtlxx.oms.mapper;

import com.xmtlxx.oms.domain.Contacts;
import com.xmtlxx.oms.domain.bo.ContactsBo;
import com.xmtlxx.oms.domain.vo.ContactsVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xmtlxx.common.annotation.DataColumn;
import com.xmtlxx.common.annotation.DataPermission;
import com.xmtlxx.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 联系人Mapper接口
 *
 * @author xmtlxx
 * @date 2022-08-12
 */
public interface ContactsMapper extends BaseMapperPlus<ContactsMapper, Contacts, ContactsVo> {
    /**
     * 根据条件分页查询联系人
     *
     * @param contacts 联系人
     * @return Page Contacts
     */
    @DataPermission({
        @DataColumn(key = "tenantName", value = "c.create_by"),
        @DataColumn(key = "deptName", value = "c.dept_id"),
        @DataColumn(key = "userName", value = "c.create_by")
    })
    Page<ContactsVo> selectPageContactsList(@Param("page") Page<Contacts> page,@Param("contacts") ContactsBo contacts);

    /**
     * 查询联系人列表
     *
     * @param contacts 联系人
     * @return 联系人集合
     */
    @DataPermission({
        @DataColumn(key = "tenantName", value = "c.create_by"),
        @DataColumn(key = "deptName", value = "c.dept_id"),
        @DataColumn(key = "userName", value = "c.create_by")
    })
    List<ContactsVo> selectContactsList(@Param("contacts") ContactsBo contacts);

    @DataPermission({
        @DataColumn(key = "tenantName", value = "c.create_by"),
    })
    List<ContactsVo> treeContactsList(@Param("contacts") ContactsBo contacts);

    ContactsVo selectContactsVoByID(String id);
}
